<template>
<div>
   <div class="newsInfo_contaniner">
       <h4>{{newsInfo.title}}</h4>
       <p>
           <span>发表时间：{{newsInfo.add_time | timeFormat}}</span>
           <span>点击：{{newsInfo.click}}次</span>
       </p>
       <hr/>
       <div class="content" v-html="newsInfo.content"></div>
   </div>
   <comment-box></comment-box>
   </div>
</template>
<script>
import comment from "../subcommemts/comment.vue"
    export default {
        data(){
         return {
        newsInfo:{}
         }
        },
        created(){
          this.getNewsInfo()
        },
        methods:{
           getNewsInfo(){
               var id=this.$route.params.id;
               this.$http.get("api/getnew/"+id).then(result=>{
                   this.newsInfo=result.body.message[0]
               })
           }
        },
        components:{
			"comment-box":comment
		}
    }
</script>
<style lang="scss">
.newsInfo_contaniner{
    padding: 0 3px;
    h4{
        font-size: 16px;
        color: cadetblue;
        text-align: center;
    }
    p{
        display: flex;
        justify-content: space-between;
        padding-top: 20px;
    };
    .content{
        img{
            width: 100%;
            height: 100%;
        }
    }
}
</style>
